﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Skyworth.CRM.Service.Entity;
using Skyworth.CRM.Common;
using Skyworth.CRM.Service.IDAL;
using Skyworth.CRM.Service.IBLL;

namespace Skyworth.CRM.BLL
{
    public class CustomerBLL : ICustomerBLL
    {
        private ICustomerDAL _customerDAL;
        public CustomerBLL(ICustomerDAL customerDal)
        {
            _customerDAL = customerDal;
        }

        public void Add(Customer model, List<CustContact> listContact, List<CustDree> listAdd)
        {
            _customerDAL.Add(model, listContact, listAdd);
        }
        public void Update(Customer model, List<CustContact> listContact, List<CustDree> listAdd)
        {
            _customerDAL.Update(model, listContact, listAdd);
        }

        public void Delete(int custId)
        {
            _customerDAL.Delete(custId);
        }
        public Customer GetModel(int custId)
        {
            return _customerDAL.GetModel(custId);
        }
        public bool Exists(string custCode, out int custId)
        {
            return _customerDAL.Exists(custCode, out custId);
        }
        public DataTable Query(string strWhere)
        {
            return _customerDAL.Query(strWhere);
        }

        public DataTable GetCustomerssByPage(string strWhere, string strOrderBy, int pageIndex, int pageSize, out int recordCount, out int pageCount)
        {
            return _customerDAL.GetCustomerssByPage(strWhere, strOrderBy, pageIndex, pageSize, out recordCount,
                                                    out pageCount);
        }

        public void DeletePriceCust(int policyId, int custId)
        {
            _customerDAL.DeletePriceCust(policyId,custId);
        }

        public void AddPriceCust(int policyId, int custId)
        {
            _customerDAL.AddPriceCust(policyId,custId);
        }
      
    }
}